// 工具栏按钮跳转页
var funcDivUrl = ['../search/Search.html','../history/CollectItem.html','../history/Record.html'];
// 选集
var videoListJson = [
   {'title': '1-6', 
   	'content': [
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'},
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'},
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'},
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'},
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'},
			   		{'cover': '../image/match/v-cover.png', 'title': '卖苗郎'}
			   	]
   }
];

var curPage = 0;
var numInner = '';

//for(var i = 0; i < videoListJson.length; i++){
//	if(i == 0){
//		numInner += '<div id="number'+ i +'" class="number-item number-acti">'+ videoListJson[i]['title'] +'</div>';
//	}else{
//		if((i+1)%17 == 0){
//			numInner += '<div id="number'+ i +'" class="number-item clearM">'+ videoListJson[i]['title'] +'</div>';
//		}else{
//			numInner += '<div id="number'+ i +'" class="number-item">'+ videoListJson[i]['title'] +'</div>';
//		}
//	}
//	
//}

//document.getElementById('number').innerHTML = numInner;

changeVideo(curPage);

function changeVideo(curPage){
	var videoListInner = '';
	var list = videoListJson[curPage]['content'];
	for(var i = 0; i < list.length; i++){
		if((i+1)%7 == 0){
			videoListInner += '<div ican="true" id="videoItem'+ i +'" class="video-item clearM">\
					<div class="v-cover" style="background:url('+ list[i]['cover'] +')"></div>\
					<div class="v-infoDiv">\
						<div class="v-info">\
							<p>'+list[i]['title']+'</p>\
						</div>\
					</div>\
				</div>';
		}
		else{
			videoListInner += '<div ican="true" id="videoItem'+ i +'" class="video-item">\
					<div class="v-cover" style="background:url('+ list[i]['cover'] +')"></div>\
					<div class="v-infoDiv">\
						<div class="v-info">\
							<p>'+list[i]['title']+'</p>\
						</div>\
					</div>\
				</div>';
		}	
	}

	document.getElementById('videoListWrapper').innerHTML = videoListInner;
}

// 计算页面比例
var wW = document.body.clientWidth || document.documentElement.clientWidth; 
var ratio = wW / 1920;
var numberLength = document.getElementsByClassName('number-item').length;
document.getElementById('number').style.width = (80 * numberLength + (numberLength-1)*18*ratio) + 'px';

var funcDiv= document.getElementsByClassName("funcDiv")[0];
var video = document.getElementById("video");
var tag = document.getElementById("tag");
var btnDiv = document.getElementById("btnDiv");
var number = document.getElementById("number");
var videoListWrapper = document.getElementById("videoListWrapper");

// 是否收藏
var isCollect = 0;
// 加载页面默认第一个选中元素
addClass(video, 'focus');
addClass(video, 'video-acti');


// 获取焦点元素
function getActiveElement(){
	var rel = document.querySelector(".focus")
	return rel;
}

// 父元素是否包含子元素
var contains = function(parentNode, childNode) {
    if (parentNode.contains) {
        return parentNode != childNode && parentNode.contains(childNode);
    } else {
        return !!(parentNode.compareDocumentPosition(childNode) & 16);
    }
}

function clearClassInList(className,listID){
	var list = document.getElementById(listID).children;
	for(var i =0; i<list.length; i++){
		if(hasClass(list[i],className)){
			removeClass(list[i],className);
		}
	}
}

function getAssignItemByClass(className,listID){
	var list = document.getElementById(listID).children;
	var result;
	for(var i =0; i<list.length; i++){
		if(hasClass(list[i],className)){
			result = list[i];
		}
	}
	return result;
}

function changeArrowOpacity(direction, item){
	switch(direction){
		case 'l':
			if(item.previousElementSibling == null){
				document.getElementById("arrow-right").style.opacity = 0.5;
    			document.getElementById("arrow-left").style.opacity = 0;
    			return;
    		}else{
    			document.getElementById("arrow-right").style.opacity = 0.5;
    			document.getElementById("arrow-left").style.opacity = 0.5;
    		} 
			break;
		case 'r':
			if(item.nextElementSibling == null){
    			document.getElementById("arrow-right").style.opacity = 0;
    			document.getElementById("arrow-left").style.opacity = 0.5;
    			return;
    		}else{
    			document.getElementById("arrow-right").style.opacity = 0.5;
    			document.getElementById("arrow-left").style.opacity = 0.5;
    		} 
			break;	
	}
}


// 赛事页面控制焦点
function setFocusEl(direction, containerEl, curActiveElem){
	var nextEl = containerEl;
	switch(containerEl){
		case funcDiv:
		    switch(direction){
		    	case 'l':
		    		if(curActiveElem.previousElementSibling == null) return;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'search-acti');
		    		removeClass(curActiveElem, 'favorite-acti');
		    		removeClass(curActiveElem, 'history-acti');
		    		curActiveElem = curActiveElem.previousElementSibling;
		    		
		    		switch(curActiveElem.index()){
		    			case 0:
		    				addClass(curActiveElem, 'search-acti');
		    				break;
		    			case 1:
		    				addClass(curActiveElem, 'favorite-acti');	
		    				break;
		    		}	
		    		addClass(curActiveElem, 'focus');
		    		break;
		    	case 'r':
		    		if(curActiveElem.nextElementSibling == null) return;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'search-acti');
		    		removeClass(curActiveElem, 'favorite-acti');
		    		removeClass(curActiveElem, 'history-acti');
		    		curActiveElem = curActiveElem.nextElementSibling;
		    		switch(curActiveElem.index()){
		    			case 1:
		    				addClass(curActiveElem, 'favorite-acti');	
		    				break;
		    			case 2:
		    				addClass(curActiveElem, 'history-acti');	
		    				break;
		    		}	
		    		addClass(curActiveElem, 'focus');
		    		break;
		    	case 'u':
		    		return;
		    		break;
		    	case 'd':
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'search-acti');
		    		removeClass(curActiveElem, 'favorite-acti');
		    		removeClass(curActiveElem, 'history-acti');
		    		curActiveElem = video;
	    			addClass(curActiveElem, 'focus');
	    			addClass(curActiveElem, 'video-acti');
		    		break;			
		    }
		    break;
		case video:
		    switch(direction){
		    	case 'l':
		    		return;
		    		break;
		    	case 'r':
		    		nextEl = tag;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'video-acti');
		    		curActiveElem = nextEl.firstElementChild;
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'tagItem-acti');
		    		break;
		    	case 'u':
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'video-acti');
		    		addClass(funcDiv.children[0], 'search-acti');//焦点跳到搜索
		    		addClass(funcDiv.children[0], 'focus');
		    		break;
		    	case 'd':
		    		// 跳到number先清除高亮状态
		    		clearClassInList('number-acti', 'number');
		    		nextEl = number;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'video-acti');
		    		// 设置专辑第一个元素为焦点
		    		curActiveElem = nextEl.firstElementChild;
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'number-acti');
		    		var index = parseInt(curActiveElem.id.replace('number',''));
	      			changeVideo(index);
		    		break;			
		    }
		    break;
		case tag:
			switch(direction){
		    	case 'l':
		    		if(curActiveElem == curActiveElem.parentNode.firstElementChild){//跳到video
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'tagItem-acti');
		    			curActiveElem = video;
		    			addClass(curActiveElem, 'focus');
		    			addClass(curActiveElem, 'video-acti');
		    			
		    		}else{
		    			removeClass(curActiveElem, 'focus');
			    		removeClass(curActiveElem, 'tagItem-acti');
			    		curActiveElem = curActiveElem.previousElementSibling;
			    		addClass(curActiveElem, 'focus');
			    		addClass(curActiveElem, 'tagItem-acti');
		    		}
		    		break;
		    	case 'r':
		    		if(curActiveElem.nextElementSibling == null) return;
	    			removeClass(curActiveElem, 'focus');
	    			removeClass(curActiveElem, 'tagItem-acti');
	    			curActiveElem = curActiveElem.nextElementSibling;
	    			addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'tagItem-acti');
		    		break;
		    	case 'u':
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'tagItem-acti');
		    		addClass(funcDiv.children[0], 'search-acti');//焦点跳到搜索
		    		addClass(funcDiv.children[0], 'focus');
		    		break;
		    	case 'd':
		    		nextEl = btnDiv;
		    		removeClass(curActiveElem, 'focus');
			      	removeClass(curActiveElem, 'tagItem-acti');
		    		curActiveElem = nextEl.firstElementChild;
			      	addClass(curActiveElem, 'focus');
			      	addClass(curActiveElem, 'btnItem-acti');
		    		break;			
		    }
		    break;
		case btnDiv:
			switch(direction){
		    	case 'l':
	    			if(curActiveElem == curActiveElem.parentNode.firstElementChild){//跳到video
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'btnItem-acti');
		    			curActiveElem = video;
		    			addClass(curActiveElem, 'focus');
		    			addClass(curActiveElem, 'video-acti');
		    		}else{
		    			removeClass(curActiveElem, 'focus');
			    		removeClass(curActiveElem, 'btnItem-acti');
			    		curActiveElem = curActiveElem.previousElementSibling;
			    		addClass(curActiveElem, 'focus');
			    		addClass(curActiveElem, 'btnItem-acti');
		    		}
		    		break;
		    	case 'r':
		    		if(curActiveElem.nextElementSibling == null) return;
	    			removeClass(curActiveElem, 'focus');
	    			removeClass(curActiveElem, 'btnItem-acti');
	    			curActiveElem = curActiveElem.nextElementSibling;
	    			addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'btnItem-acti');
		    		break;
		    	case 'u':
		    		nextEl = tag;
		    		removeClass(curActiveElem, 'focus');
			      	removeClass(curActiveElem, 'btnItem-acti');
		    		curActiveElem = nextEl.firstElementChild;
			      	addClass(curActiveElem, 'focus');
			      	addClass(curActiveElem, 'tagItem-acti');
		    		break;
		    	case 'd':
		    		// 跳到number先清除高亮状态
		    		clearClassInList('number-acti', 'number');
		    		nextEl = number;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'btnItem-acti');
		    		curActiveElem = nextEl.firstElementChild;
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'number-acti');
		    		break;			
		    }
		    break;
		case number:
			switch(direction){
		    	case 'l':
		    		if(curActiveElem.previousElementSibling == null) return;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'number-acti');
		    		curActiveElem = curActiveElem.previousElementSibling;
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'number-acti');
		    		changeArrowOpacity('l', curActiveElem);
		    		// 更新对应视频
		    		var index = parseInt(curActiveElem.id.replace('number',''));
	      			changeVideo(index);
	      			// 播放集数整屏移动
	      			if(index!=0 && index%16==0){
	      				// 集数div宽度
						var numberDivW = document.getElementById("numberDiv").offsetWidth;
	      				document.getElementById("number").style.marginLeft = - numberDivW * Math.floor(index/17) + 'px';
	      			}
		    		break;
		    	case 'r':
		    		if(curActiveElem.nextElementSibling == null) return;
		    		removeClass(curActiveElem, 'focus');
		    		removeClass(curActiveElem, 'number-acti');
	    			curActiveElem = curActiveElem.nextElementSibling;
	    			addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'number-acti');
		    		changeArrowOpacity('r', curActiveElem);
		    		// 更新对应视频
		    		var index = parseInt(curActiveElem.id.replace('number',''));
	      			changeVideo(index);
	      			if(index!=0 && index%17==0){
						var numberDivW = document.getElementById("numberDiv").offsetWidth;
	      				document.getElementById("number").style.marginLeft = - numberDivW * Math.floor(index/17) + 'px';
	      			}
		    		break;
		    	case 'u':
		    		removeClass(curActiveElem, 'focus');
			      	curActiveElem = video;
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'video-acti');
		    		// 恢复number的margin值
		    		document.getElementById("number").style.marginLeft = 0 + 'px';
		    		// 清除number之前高亮状态
		    		clearClassInList('number-acti', 'number');
		    		addClass(number.children[0], 'number-acti');
		    		changeVideo(0);
		    		break;
		    	case 'd':
		    		removeClass(curActiveElem, 'focus');
		    		// 判断number在哪个video上方
		    		var index = parseInt(curActiveElem.id.replace('number',''));
		    		if(index%17==0 || index%17==1 || index%17==2 || index%17==3 || index%17==4){
		    			curActiveElem = videoListWrapper.children[0];
		    		}else if(index%17==5 || index%17==6 || index%17==7 || index%17==8 || index%17==9 || index%17==10){
		    			curActiveElem = videoListWrapper.children[1];
		    		}else{
		    			curActiveElem = videoListWrapper.children[2];
		    		}
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'videoItem-acti');
		    		break;			
		    }
		    break;
		case videoListWrapper:
			switch(direction){
		    	case 'l':
		    		var actiNumber = getAssignItemByClass('number-acti','number');

		    		var numIndex = parseInt(actiNumber.id.replace('number',''));
		    		if(numIndex == 0){
		    			if(curActiveElem.previousElementSibling == null) return;
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'videoItem-acti');
		    			curActiveElem = curActiveElem.previousElementSibling;
		    		}else{
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'videoItem-acti');
		    			var index = parseInt(curActiveElem.id.replace('videoItem',''));
			    		if(index%3 == 0){//翻页
			    			// 播放集数整屏移动
			      			if((numIndex-1)!=0 && (numIndex-1)%16==0){
			      				var numberDivW = document.getElementById("numberDiv").offsetWidth;
			      				document.getElementById("number").style.marginLeft = - numberDivW * Math.floor((numIndex-1)/17) + 'px';
			      			}
			    			changeVideo(numIndex-1);
			    			clearClassInList('number-acti', 'number');
			    			addClass(number.children[numIndex-1],'number-acti');
			    			actiNumber = getAssignItemByClass('number-acti','number');
			    			changeArrowOpacity('l', actiNumber);
			    			curActiveElem = videoListWrapper.children[0];
			    		}else{
			    			curActiveElem = curActiveElem.previousElementSibling;
			    		}
		    		}
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'videoItem-acti');
		    		break;
		    	case 'r':
		    		var actiNumber = getAssignItemByClass('number-acti','number');
		    		var numIndex = parseInt(actiNumber.id.replace('number',''));

		    		if(numIndex == number.children.length - 1){
		    			if(curActiveElem.nextElementSibling == null) return;
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'videoItem-acti');
		    			curActiveElem = curActiveElem.nextElementSibling;
		    		}else{
		    			removeClass(curActiveElem, 'focus');
		    			removeClass(curActiveElem, 'videoItem-acti');
		    			var index = parseInt(curActiveElem.id.replace('videoItem',''));
			    		if(index%3 == 2){//翻页
			    			if((numIndex+1)!=0 && (numIndex+1)%17==0){
			    				var numberDivW = document.getElementById("numberDiv").offsetWidth;
			      				document.getElementById("number").style.marginLeft = - numberDivW * Math.floor((numIndex+1)/17) + 'px';
			      			}
			    			changeVideo(numIndex+1);
			    			clearClassInList('number-acti', 'number');
			    		    addClass(number.children[numIndex+1],'number-acti');
			    		    actiNumber = getAssignItemByClass('number-acti','number');
			    			changeArrowOpacity('r', actiNumber);
			    			curActiveElem = videoListWrapper.children[0];
			    		}else{
			    			curActiveElem = curActiveElem.nextElementSibling;
			    		}
		    		}
		    		addClass(curActiveElem, 'focus');
		    		addClass(curActiveElem, 'videoItem-acti');
		    		break;
		    	case 'u':
		    		removeClass(curActiveElem, 'focus');
			      	removeClass(curActiveElem, 'videoItem-acti');
		    		var index = parseInt(curActiveElem.id.replace('videoItem',''));
		    		if(index%6==0 || index%6==1 || index%6==2){
		    			// 跳到number
		    			var actiNumber = getAssignItemByClass('number-acti','number');
		    			curActiveElem = actiNumber;
		    			addClass(curActiveElem, 'focus');	
		    		}else if(index%6==3 || index%6==4 || index%6==5){
		    			curActiveElem = videoListWrapper.children[index - 3];
		    			addClass(curActiveElem, 'focus');
		    			addClass(curActiveElem, 'videoItem-acti');
		    		}
		    		break;
		    	case 'd':
		    		var videoLength = videoListWrapper.children.length;
		    		var index = parseInt(curActiveElem.id.replace('videoItem',''));
		    		if(videoLength<4) return;
		    		if(videoLength == 4){
		    			if(index%6 > 0) return;
		    			removeClass(curActiveElem, 'focus');
			      		removeClass(curActiveElem, 'videoItem-acti');
		    			curActiveElem = videoListWrapper.children[index + 3];
		    			addClass(curActiveElem, 'focus');
		    			addClass(curActiveElem, 'videoItem-acti');
		    		}else if(videoLength == 5){
		    			if(index%6 > 1) return;
		    			removeClass(curActiveElem, 'focus');
			      		removeClass(curActiveElem, 'videoItem-acti');
		    			curActiveElem = videoListWrapper.children[index + 3];
		    			addClass(curActiveElem, 'focus');
		    			addClass(curActiveElem, 'videoItem-acti');
		    		}else{
		    			if(index%6==0 || index%6==1 || index%6==2){
		    				// 跳到下一行
			    			removeClass(curActiveElem, 'focus');
				      		removeClass(curActiveElem, 'videoItem-acti');
			    			curActiveElem = videoListWrapper.children[index + 3];
			    			addClass(curActiveElem, 'focus');
			    			addClass(curActiveElem, 'videoItem-acti');
		    			}
		    		}
		    		break;			
		    }
		    break;        
	}
}

// document.onkeydown = remoteControl;

function remoteControl(){
	e=window.event||e;
	switch(e.which){
	    case 37: //左键
	      	var curActiveElem = getActiveElement();
	        if(contains(funcDiv, curActiveElem)){
	      		setFocusEl('l', funcDiv, curActiveElem);
	      	}else if(curActiveElem == video){//视频
	      		setFocusEl('l', video, curActiveElem);
	      	}else if(contains(tag,curActiveElem)){//标签
	      		setFocusEl('l', tag, curActiveElem);
	      	}else if(contains(btnDiv,curActiveElem)){//按钮
	      		setFocusEl('l', btnDiv, curActiveElem);
	      	}else if(contains(number,curActiveElem)){//集数
	      		setFocusEl('l', number, curActiveElem);	    
	      	}else{
	      		setFocusEl('l', videoListWrapper, curActiveElem);//视频列表
	      	}
	      	break;
	    case 38: //上键
	      	var curActiveElem = getActiveElement();
	      	if(contains(funcDiv, curActiveElem)){
	      		setFocusEl('u', funcDiv, curActiveElem);
	      	}else if(curActiveElem == video){
	      		setFocusEl('u', video, curActiveElem);
	      	}else if(contains(tag,curActiveElem)){
	      		setFocusEl('u', tag, curActiveElem);
	      	}else if(contains(btnDiv,curActiveElem)){
	      		// 热播榜-特殊
	      		setFocusEl('u', btnDiv, curActiveElem);
	      	}else if(contains(number,curActiveElem)){
	      		setFocusEl('u', number, curActiveElem);
	      	}else{
	      		setFocusEl('u', videoListWrapper, curActiveElem);
	      	}
	      	break;
	    case 39: //右键
	      	var curActiveElem = getActiveElement();

	      	if(contains(funcDiv, curActiveElem)){
	      		setFocusEl('r', funcDiv, curActiveElem);
	      	}else if(curActiveElem == video){
	      		setFocusEl('r', video, curActiveElem);
	      	}else if(contains(tag,curActiveElem)){
	      		setFocusEl('r', tag, curActiveElem);
	      	}else if(contains(btnDiv,curActiveElem)){
	      		setFocusEl('r', btnDiv, curActiveElem);
	      	}else if(contains(number,curActiveElem)){
	      		setFocusEl('r', number, curActiveElem);
	      	}else{
	      		setFocusEl('r', videoListWrapper, curActiveElem);
	      	}
	      	break;
	    case 40: //下键
	      	var curActiveElem = getActiveElement();
	      	if(contains(funcDiv, curActiveElem)){
	      		setFocusEl('d', funcDiv, curActiveElem);
	      	}else if(curActiveElem == video){
	      		setFocusEl('d', video, curActiveElem);
	      	}else if(contains(tag,curActiveElem)){
	      		setFocusEl('d', tag, curActiveElem);
	      	}else if(contains(btnDiv,curActiveElem)){
	      		setFocusEl('d', btnDiv, curActiveElem);
	      	}else if(contains(number,curActiveElem)){
	      		setFocusEl('d', number, curActiveElem);
	      	}else{
	      		setFocusEl('d', videoListWrapper, curActiveElem);
	      	}
	      	break;
	    case 13: //回车键
	    	var curActiveElem = getActiveElement();
	    	if(contains(funcDiv, curActiveElem)){
	      		switch(curActiveElem.index()){
	      			case 0:
	      				// 跳转到搜索页
	      				window.location.href = funcDivUrl[0];
	      				break;
	      			case 1:
	      				// 跳转到搜藏
	      				window.location.href = funcDivUrl[1];
	      				break;
	      			case 2:
	      				// 跳转到历史
	      				window.location.href = funcDivUrl[2];
	      				break;		
	      		}
	      	}else if(contains(video,curActiveElem)){
	      		// 跳转到播放页面
	      		console.log("跳转至播放页");
	      	}else if(contains(tag,curActiveElem)){
	      		// 跳进主播-所有视频页
	      		window.location.href="../anchor/anchorDetail.html";  
	      	}else if(contains(btnDiv,curActiveElem)){
	      		console.log(curActiveElem.index());
	      		if(curActiveElem.index() == 0){//收藏
	      			document.getElementById("masking").style.display = "block";
	      			if(isCollect == 0){
	      				document.getElementById("maskOK").style.display = "block";
	      				document.getElementById("collectImg").src = "../image/match/collect-acti.png";
	      				setTimeout(function(){
		      				document.getElementById("masking").style.display = "none";
		      				document.getElementById("maskOK").style.display = "none";
		      			},1000);
	      			}else{
	      				document.getElementById("maskCancle").style.display = "block";
	      				document.getElementById("collectImg").src = "../image/match/collect.png";
	      				setTimeout(function(){
		      				document.getElementById("masking").style.display = "none";
		      				document.getElementById("maskCancle").style.display = "none";
		      			},1000);
	      			}
	      			isCollect = !isCollect;
	      		}
	      		if(curActiveElem.index() == 1){
	      			// 跳转至购买页
	      			console.log("跳转至购买页");
	      		}
	      	}else if(contains(videoListWrapper,curActiveElem)){
	      		// 跳转至播放页
	      		console.log("跳转至播放页");
	      	}
	    	break;
	    case 27: // ESC
            window.history.back();
            return false;
            break;   		        
	}
}